package com.xiaoxx.rabbitmq.bean;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.amqp.rabbit.connection.CorrelationData;

/**
 * CorrelationData的自定义实现，用于消息到路由器失败后拿到消息内容
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class CorrelationDataExt extends CorrelationData {
    // 数据
    private volatile Object data;
    // 交换机
    private String exchangeName;
    // 路由key
    private String routingKey;


    public CorrelationDataExt(String format, String topic, String routingKey, Object data) {
        super(format);
        this.data = data;
        this.exchangeName = topic;
        this.routingKey = routingKey;
    }
}
